import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/getParameter")
public class GetParameterServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 预期浏览器传来 /getParameter?aa=10&bb=20
        Integer aa = Integer.parseInt(req.getParameter("aa"));
        Integer bb = Integer.parseInt(req.getParameter("bb"));
        resp.setContentType("text/html; charset=utf8");
        resp.getWriter().write("aa = " + aa + ", bb = " + bb);

//        String queryString = req.getQueryString();
//        resp.getWriter().write("<br>");
//        resp.getWriter().write(queryString);
    }
}
